<template>
	<view class="content">
	  <view class="cu-bar bg-white search" :style="[{top:CustomBar + 'px'}]">
	  	<view class="search-form round">
	  		<text class="cuIcon-search"></text>
	  		<input type="text" placeholder="输入搜索的帖名或用户名" confirm-type="search" :value="inputValue" @input="getValue" @confirm="show"></input>
	  	</view>
	  	<view>
	  		<button class="cu-btn bg-gradual-green shadow-blur round" @click="show">搜索</button>
	  	</view>
	  </view>
	  <view v-if="showCheck">
		  文件名称:{{title}}  提交用户:{{userName}} 
	  </view>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				title:'',
				inputValue:'',
				userName:'',
				showCheck:false
			}
		},
		methods: {
			show(){
				var that=this;
				uni.request({
					url: 'http://rap2api.taobao.org/app/mock/286869/user/searchfile',
					method: 'GET',
					data: {
						searchValue:that.inputValue
					},
					success: res => {
						that.title=res.data.title;
						that.userName=res.data.userName;
						that.showCheck=true;
					},
					fail: () => {
						uni.showToast({
							title: '找不到您查找的内容',
							icon: 'none'
						});
					},
					complete: () => {}
				});
			},
			getValue(e){
			    this.inputValue=e.detail.value;
			}
		}
	}
</script>

<style>
</style>
